#—*—coding:utf-8 -*-
#@Time        :2022/7/16 9:49
#@Author      :dhx
#@File        :create_could_collect1_page.py
# @Software: PyCharm
from time import sleep

from selenium.webdriver.common.by import By
from pages.finance_page import FinancePage

from pages.base_pageage import BasePage
class TestCouldPayOne(BasePage):
    url='http://192.168.3.133/crm/index.php?m=finance&a=add&t=receivables'


    name_locator=(By.XPATH,'//*[@id="name"]')#定位收款名
    customer_locator=(By.ID,'customer')#客户
    option_customer=(By.XPATH,'//*[@id="datas"]/tr/td[1]/input[1]')#选择第一个
    ok_locator=(By.XPATH,'/html/body/div[7]/div[3]/div/button[1]')
    people_locator=(By.ID,'owner_name')#负责人
    option_person_locator=(By.XPATH,'//*[@id="d_content"]/tr[1]/td[1]/input')#选择第一个负责人
    option_person_two_locator=(By.XPATH,'//*[@id="d_content"]/tr[2]/td[1]/input')#选择第二个负责人
    ok_person_locator=(By.XPATH,'/html/body/div[9]/div[3]/div/button[1]/span')#点击保存
    price_locator=(By.ID,'price')#金额
    time_locator=(By.ID,'pay_time')#时间
    description=(By.XPATH,'/html/body/div[5]/div[2]/div/form/table/tbody/tr[9]/td[2]/textarea')#描述
    save_locator=(By.XPATH,'/html/body/div[5]/div[2]/div/form/table/tfoot/tr/td[2]/input[1]')#保存
    def name_could(self,na):
        """输入应收款名"""
        self.driver.find_element(*self.name_locator).send_keys(na)
        sleep(1)

    def customer(self):
        """选择客户"""
        self.driver.find_element(*self.customer_locator).click()
        sleep(1)
    def person_duty(self):
        """选择第一个客户"""
        self.driver.find_element(*self.option_customer).click()
        sleep(1)
    def save_customer(self):
        """点击保存"""
        self.driver.find_element(*self.ok_locator).click()
        sleep(1)
    def option_person(self):
        """选择负责人"""
        self.driver.find_element(* self.people_locator).click()
        sleep(1)
    def option_two_person(self):
        """选择第二个负责人"""
        self.driver.find_element(*self.option_person_two_locator).click()
    def first_option(self):
        """勾选第一个"""
        self.driver.find_element(*self.option_person_locator).click()
        sleep(1)
    def save_option(self):
        """保存"""
        self.driver.find_element(*self.ok_person_locator).click()
        sleep(1)

    def input_price(self,pri):
         """保存"""
         self.driver.find_element(*self.price_locator).send_keys(pri)
         sleep(1)
    def time_price(self,time):
         """输入收款时间"""
         self.driver.find_element(*self.time_locator).send_keys(time)
         sleep(1)
    def descrip(self,desc):
         """输入描述"""
         self.driver.find_element(*self.description).send_keys(desc)
         sleep(1)
    def f_save(self):
         """点击保存"""
         self.driver.find_element(*self.save_locator).click()
         sleep(1)












